package com.sw.controller;

import com.sw.pojo.Result;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.File;
import java.io.IOException;
import java.util.UUID;

@RestController
public class FileUploadController {
    @PostMapping("/upload")
    public Result<String> upload(MultipartFile file) throws IOException {
        //把文件存到本地磁盘上
        file.transferTo(new File("D:\\chromeStorage\\" + UUID.randomUUID() +"-"+ file.getOriginalFilename()));
        return Result.success("url访问地址...");
    }
}
